 //
//  Emoticon.m
//  Emoticon
//
//  Created by 袁量 on 2017/8/12.
//  Copyright © 2017年 袁量. All rights reserved.
//

#import "Emoticon.h"
#import "NSString+emoji.h"
@implementation Emoticon
- (id) initWithDict : (NSDictionary *)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
- (id)initWithIsRemove:(BOOL)isRemove{
    if (self = [super init]){
        self.isRemove = isRemove;
    }
    return self;
}
- (id)initWithIsEmpty:(BOOL)isEmpty{
    if (self = [super init]) {
        self.isEmpty = isEmpty;
    }
    return self;
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
- (NSString *)description{
    return [self dictionaryWithValuesForKeys:@[@"emojiCode",@"pngPath",@"chs"]].description;
}

- (void)setPng:(NSString *)png{
    _png = png;
    if (png == nil) {
        return;
    }
    _pngPath = [[[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"Emoticons.bundle"] stringByAppendingPathComponent:png];
}
- (void)setCode:(NSString *)code{
    _code = code;
    if (code == nil) {
        return;
    }
//    UniChar emoji = strtoul([code UTF8String],0,0);
//    _emojiCode = [NSString stringWithFormat:@"%C",emoji];
    _emojiCode =[NSString emojiWithStringCode:code];
    
}
@end 
